﻿using System;
using System.Collections;
using System.Runtime.CompilerServices;
using UnityEngine;

namespace UniRx.Examples
{
	// Token: 0x020001EF RID: 495
	public class Sample10_MainThreadDispatcher
	{
		// Token: 0x06000A5A RID: 2650 RVA: 0x000379D8 File Offset: 0x00035DD8
		public void Run()
		{
			MainThreadDispatcher.StartCoroutine(this.TestAsync());
			Observable.FromCoroutine(new Func<IEnumerator>(this.TestAsync), false).Subscribe<Unit>();
			MainThreadDispatcher.Post(delegate(object _)
			{
				Debug.Log("test");
			}, null);
			Observable.Interval(TimeSpan.FromSeconds(1.0)).Subscribe(delegate(long x)
			{
				Debug.Log(x);
			});
			if (Sample10_MainThreadDispatcher.FuncCallback0 == null)
			{
				//Sample10_MainThreadDispatcher.FuncCallback0 = new Func<Unit>(Unit.Default);
			}
			Observable.Start<Unit>(Sample10_MainThreadDispatcher.FuncCallback0).ObserveOnMainThread<Unit>().Subscribe(delegate(Unit x)
			{
				Debug.Log(x);
			});
		}

		// Token: 0x06000A5B RID: 2651 RVA: 0x00037AAC File Offset: 0x00035EAC
		private IEnumerator TestAsync()
		{
			Debug.Log("a");
			yield return new WaitForSeconds(1f);
			Debug.Log("b");
			yield return new WaitForSeconds(1f);
			Debug.Log("c");
			yield return new WaitForSeconds(1f);
			Debug.Log("d");
			yield break;
		}

		// Token: 0x040006C3 RID: 1731
		[CompilerGenerated]
		private static Func<Unit> FuncCallback0;
	}
}
